gdk/wayland: use the multi-thread safe wayland API
authorMatthew Waters <matthew@centricular.com>
Fri, 18 Mar 2016 06:17:23 +0000 (17:17 +1100)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 18 May 2016 02:58:03 +0000 (22:58 -0400)
commit2893526a48b6edae452d966cf9779f4ef0a23a15
tree6fb7dc21216d673b4e88a6303447da49a0e35d13
parent096bea3f0ea8e80fe4c9a2a1a860f32c8a94cc33
gdk/wayland: use the multi-thread safe wayland API

This is required for proper integration with any other library/application that
may perform wayland API calls and poll() the wayland fd from multiple threads.
Using wl_display_dispatch{_queue}() is thread-safe if not mixed with custom
poll() usage, which GSource/GMainContext does.

Essentially, the problem is that multiple threads polling and reading
the same fd is extremely racy.  Use the wayland provided API for allowing
concurrent access to the wayland display fd.

See the wayland man pages for wl_display_prepare_read(),
wl_display_cancel_read() and wl_display_read_events() for more details.

https://bugzilla.gnome.org/show_bug.cgi?id=763852
gdk/wayland/gdkeventsource.c